package com.xcw.jac.optional;

import com.sun.deploy.util.StringUtils;

import java.util.Objects;
import java.util.Optional;

/**
 * @author xcw
 * @date 2023/8/17 9:38
 * @description optional练习类
 */
public class OptionalTest {
    public static void main(String[] args) {
        System.out.println(optionals(""));
        System.out.println(optionals("abcd"));
        ThreadLocal threadLocal = new ThreadLocal();
    }
    public static String optionals(String code) {
        String cctv = Optional.ofNullable(code).filter(o -> !"".equalsIgnoreCase(o)).orElse("cctv");
        return cctv;
    }
}
